package com.suoyue.store.config;

import com.suoyue.store.interceptor.AdminInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class AdminInterceptorConfigurer implements WebMvcConfigurer {
    HandlerInterceptor interceptor2 = new AdminInterceptor();
    /** 拦截器配置 */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 创建拦截器对象
        HandlerInterceptor interceptor2 = new AdminInterceptor();

        // 通过注册工具添加拦截器
        registry.addInterceptor(interceptor2).addPathPatterns("/manage.html");
    }
}
